//
// Created by miaomiaole on 2024/1/13.
//
#include <iostream>
#include "opencv2/core.hpp"
#include "opencv2/highgui.hpp"

using namespace cv;
using namespace std;

int main() {
    auto imgs = imread("../picture_1663037518439.jpeg");
    auto imgs_gray = imread("../picture_1663037518439.jpeg", 0);

    // Write images, 保存图片路径
    imwrite("./lenaGray.jpg", imgs_gray);


    cout << "rows: " << imgs.rows << endl;
    cout << "cols: " << imgs.cols << endl;

    for (int i = 0; i < imgs.rows; ++i) {
        for (int j = 0; j < imgs.cols; ++j) {
            auto pixel = imgs.at<Vec3b>(i, j);
            cout << "(" << i << "," << j << "):" << "Pixel value (B,G,R): ("
                 << (int) pixel[0] << ","
                 << (int) pixel[1] << ","
                 << (int) pixel[2] << ")"
                 << endl;
        }
    }


    Size s(100, 100);
    auto white = Mat::zeros(s,CV_8UC1);
    s.width = 200;
    s.area()

    // Show images
    imshow("lena BGR", imgs);
    imshow("lena Gray", imgs_gray);

    waitKey(0);


}